﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BTCairo
{
    public class Border : Effect
    {
        BasicEllipse c1, c2, c3, c4;
        BasicRect r1, r2, r3, r4;
        public override void DoEffect(Shape shape)
        {
            InfoGraphic info = shape.getInfoShape();
            CommonGraphics g = shape.myCommonGraphic.CloneCommonGraphic();
            g.MyInfoGraphic.fill = true;
            g.MyInfoGraphic.lineRed = 80;
            g.MyInfoGraphic.lineGreen = 80;
            g.MyInfoGraphic.lineBlue = 80;
            g.MyInfoGraphic.fillRed = 80;
            g.MyInfoGraphic.fillGreen = 80;
            g.MyInfoGraphic.fillBlue = 80;
            int left = info.x - 2;
            int right = info.x + info.widthShape + 2;
            int top = info.y - 2;
            int bot = info.y + info.heightShape + 2;
            c1 = new BasicEllipse(g, left, top, 5, 5);
            c2 = new BasicEllipse(g, right, top, 5, 5);
            c3 = new BasicEllipse(g, right, bot, 5, 5);
            c4 = new BasicEllipse(g, left, bot, 5, 5);
            r1 = new BasicRect(g, (left + right) / 2, top, 5, 5);
            r2 = new BasicRect(g, right, (top + bot) / 2, 5, 5);
            r3 = new BasicRect(g, (left + right) / 2, bot, 5, 5);
            r4 = new BasicRect(g, left, (top + bot) / 2, 5, 5);

            c1.Draw();
            c2.Draw();
            c3.Draw();
            c4.Draw();
            r1.Draw();
            r2.Draw();
            r3.Draw();
            r4.Draw();
        }

        public override void ParseXmlElement(System.Xml.XmlDocument doc, System.Xml.XmlElement root)
        {
            c1.ParseXmlElement(doc, root);
            c2.ParseXmlElement(doc, root);
            c3.ParseXmlElement(doc, root);
            c4.ParseXmlElement(doc, root);
            r1.ParseXmlElement(doc, root);
            r2.ParseXmlElement(doc, root);
            r3.ParseXmlElement(doc, root);
            r4.ParseXmlElement(doc, root);
        }
    }
}

